// src/utils/date.js
export function getCurrentDate() {
    const now = new Date();
    const offset = 8 * 60; // 北京时间比UTC快8小时
    const localTime = new Date(now.getTime() + offset * 60 * 1000);

    const year = localTime.getUTCFullYear();
    const month = String(localTime.getUTCMonth() + 1).padStart(2, '0');
    const day = String(localTime.getUTCDate()).padStart(2, '0');

    return `${year}-${month}-${day}`;
}
export function formatDateTime(dateTimeString) {
    if (dateTimeString === undefined || dateTimeString === null){
        return '';
    }
    const date = new Date(dateTimeString);
    const year = date.getFullYear();
    const month = String(date.getMonth() + 1).padStart(2, '0');
    const day = String(date.getDate()).padStart(2, '0');
    const hour = String(date.getHours()).padStart(2, '0');
    const minute = String(date.getMinutes()).padStart(2, '0');
    const second = String(date.getSeconds()).padStart(2, '0');
    return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
}